//----------------------------------------------------------------------------
// M A R I T I M E  R E S E A R C H  I N S T I T U T E  N E T H E R L A N D S
//----------------------------------------------------------------------------
// Copyright (C) 2012 - MARIN - All rights reserved - http://www.marin.nl
//----------------------------------------------------------------------------
// Program    : mermaid
// Module     : vbm
// File       : axpy.h
// Author     : M.A. de Jong
//----------------------------------------------------------------------------

#ifndef AXPY_H
#define	AXPY_H

#include "kernels/axpy_kernels.h"

namespace rrbsolver
{

template <class T>
inline void axpy(T *dY, const T *dX, 
    const T a, const T b, const Grid grid)
{
    dimGrid.x = grid.cx / NUM_THREADS_X;
    dimGrid.y = grid.cy / NUM_THREADS_Y;
    dimBlock.x = NUM_THREADS_X;
    dimBlock.y = NUM_THREADS_Y;

    kernel_axpy<T> <<< dimGrid, dimBlock >>> (dY, dX, a, b, grid);
    checkCudaError(cudaGetLastError(), "rrbsolver::kernel_axpy");  
}

} // namespace rrbsolver

#endif // AXPY_H

